<?php
/**
 * User: xuhong
 * Date: 2018/10/30
 */

namespace extend\wechat\mp;


class Menu
{

    /**
     * 创建自定义菜单
     * @param $menu_data
     * @return mixed
     */
    public static function createMenu($menu_data)
    {
        $access_token = Voucher::accessToken()['access_token'];

        $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={$access_token}";
        return postRequest($url, $menu_data);
    }

    /**
     * 查询自定义菜单
     * @return mixed
     */
    public static function searchMenu()
    {
        $access_token = Voucher::accessToken()['access_token'];

        $url = "https://api.weixin.qq.com/cgi-bin/menu/get?access_token={$access_token}";
        return getRequest($url);
    }

    /**
     * 删除自定义菜单
     * @return mixed
     */
    public static function deleteMenu()
    {
        $access_token = Voucher::accessToken()['access_token'];

        $url = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token={$access_token}";
        return getRequest($url);
    }
}